﻿using System;
using System.Activities;
using Reactor.ServiceGrid.Workflows.Persistence;

namespace Reactor.ServiceGrid.Workflows.Activities
{
    public class RecordDonorCoreName : CodeActivity
    {
        [RequiredArgument]
        public InArgument<string> DonorCoreName { get; set; }

        protected override void Execute(CodeActivityContext context)
        {
            var dataExt = context.GetExtension<TransferServiceStatusExtension>();
            if(dataExt == null) throw new InvalidOperationException("TransferServiceWorkflow is missing TransferServiceStatusExtension.");

            dataExt.RecordDonorCoreName(context.GetValue(DonorCoreName));
        }
    }
}
